//
//  HistoryItemView.swift
//  Chatup
//
//  Created by op on 2023/10/20.
//

import SwiftUI

struct HistoryItemView: View {
    @State var model:HistoryModel
    var body: some View {
        HStack {
            ZStack(alignment:.bottomTrailing) {
                Image(model.iconString)
                    .resizable()
                    .frame(width: 56,height: 56)
                Image("icon_online")
                    .resizable()
                    .frame(width: 12,height: 12)
            }
            Spacer()
                .frame(width: 12)
//                .frame(width: 12)
            VStack(alignment:.leading){
                Text(model.name)
                    .font(.system(size: 16,weight: .medium))
                    .foregroundColor(.white)
                    .lineLimit(1)
                Spacer()
                    .frame(height: 8)
                Text(model.msg)
                    .font(.system(size: 12))
                    .multilineTextAlignment(.leading)
                    .lineLimit(1)
                    .foregroundColor(.white.opacity(0.5))
            }
            Spacer()

            Spacer()
                .frame(width: 18)
            Image("icon_right")
                .resizable()
                .frame(width: 24,height: 24)
        }
    }
}

#Preview {
    HistoryItemView(model: .init(name: "", iconString: "", msg: "", time: "", roleId: 0))
}
